using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Web.Management;

namespace OpenLightGroup.Common.ApplicationServices
{
    public class ClientErrorEvent 
        : ErrorEvent
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientErrorEvent"></see> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="eventSource">The event source.</param>
        /// <param name="e">The exception.</param>
        protected ClientErrorEvent(string message, object eventSource, Exception e)
            : base(message, eventSource, e)
        {

        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientErrorEvent"></see> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="eventSource">The event source.</param>
        /// <param name="eventDetailCode">The event detail code.</param>
        /// <param name="e">The exception.</param>
        protected ClientErrorEvent(string message, object eventSource, int eventDetailCode, Exception e)
            : base(message, eventSource, eventDetailCode, e)
        {

        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClientErrorEvent"></see> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="eventSource">The event source.</param>
        /// <param name="eventDetailCode">The event detail code.</param>
        /// <param name="e">The exception.</param>
        internal ClientErrorEvent(string message, object eventSource, int eventDetailCode, Exception e, EventLogRequest request)
            : base(message, eventSource, eventDetailCode, e)
        {
            this.EventLogRequest = request ;
        }

        public EventLogRequest EventLogRequest { get ; set ; }

        public override void FormatCustomEventDetails(WebEventFormatter formatter)
        {
            base.FormatCustomEventDetails(formatter);

            formatter.AppendLine("Client Event Details:");

            formatter.AppendLine(this.EventLogRequest.ClientDetails);
        }

    }
}
